<include file="public@header" />
</head>
<body>
    <div class="wrap">
        <ul class="nav nav-tabs">
            <li><a href="{:url('goods/index')}">列表</a></li>
            <li class="active"><a >{:lang('ADD')}</a></li>
        </ul>
        <form method="post" class="form-horizontal js-ajax-form margin-top-20" enctype="multipart/form-data" action="{:url('goods/add')}">
            <div class="row">
                <div class="form-group">
                    <label for="input-name" class="col-sm-2 control-label">名称</label>
                    <div class="col-md-6 col-sm-10">
                        <input type="text" class="form-control" name="goods_name" value="{$data.goods_name|default=''}">
                    </div>
                </div>

                <div class="form-group">
                    <label for="input-name" class="col-sm-2 control-label">副标题</label>
                    <div class="col-md-6 col-sm-10">
                        <input type="text" class="form-control" name="goods_subname" value="{$data.goods_subname|default=''}">
                    </div>
                </div>

                <div class="form-group">
                    <label for="input-name" class="col-sm-2 control-label">分类</label>
                    <div class="col-md-6">
                        <select name="cid" class="form-control">
                            <volist name="class" id="vo">
                                <option value="{$key}">{$vo}</option>
                            </volist>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label for="input-thumb" class="col-sm-2 control-label">封面图</label>
                    <div class="col-md-6 col-sm-10">
                        <input type="hidden" name="image" id="master-image" value="{filapath}">
                        <a href="javascript:uploadOneImage('图片上传','#master-image');">
                            <img src="__TMPL__/public/assets/images/default-thumbnail.png" id="master-image-preview" style="cursor: pointer;max-width:100px;" class="img-responsive">
                        </a>
                    </div>
                </div>

                <div class="form-group">
                    <label for="" class="col-sm-2 control-label">主图</label>
                    <div class="col-md-6 col-sm-2">
                        <ul id="photos" class="list-unstyled"></ul>
                        <a href="javascript:uploadMultiImage('图片上传','#photos','photos-item-wrapper');" class="btn btn-sm btn-success">添加图片</a>
                    </div>
                </div>


                <div class="form-group">
                    <label for="input-name" class="col-sm-2 control-label">价格</label>
                    <div class="col-md-6 col-sm-10">
                        <input type="text" class="form-control"  name="goods_price" value="{$data['goods_price']|default=0.00}">
                    </div>
                </div>

                <div class="form-group">
                    <label for="input-name" class="col-sm-2 control-label">库存</label>
                    <div class="col-md-6 col-sm-10">
                        <input type="text" class="form-control"  name="goods_num" value="{$data['goods_num']|default=1000}">
                    </div>
                </div>

                <div class="form-group">
                    <label for="input-name" class="col-sm-2 control-label">库存报警</label>
                    <div class="col-md-6 col-sm-10">
                        <input type="text" class="form-control"  name="warning_num" value="{$data['warning_num']|default=200}">
                    </div>
                </div>

                <div class="form-group">
                    <label for="input-name" class="col-sm-2 control-label">销量</label>
                    <div class="col-md-6 col-sm-10">
                        <input type="text" class="form-control"  name="goods_sale_num" value="{$data['goods_sale_num']|default=0}">
                    </div>
                </div>

                <div class="form-group">
                    <label for="input-name" class="col-sm-2 control-label">首页显示</label>
                    <div class="col-md-6 col-sm-10">
                        <select name="is_index" class="form-control">
                            <option value="1">显示</option>
                            <option value="0">否</option>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label for="input-name" class="col-sm-2 control-label">是否上新</label>
                    <div class="col-md-6 col-sm-10">
                        <select name="is_new" class="form-control">
                            <option value="1">上新</option>
                            <option value="0">否</option>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label for="input-name" class="col-sm-2 control-label">首页top</label>
                    <div class="col-md-6 col-sm-10">
                        <select name="is_top" class="form-control">
                            <option value="1">上top</option>
                            <option value="0">否</option>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label for="input-name" class="col-sm-2 control-label">重量</label>
                    <div class="col-md-6 col-sm-10">
                        <input type="text" class="form-control"  name="weight" value="{$data['weight']|default=0.00}">
                    </div>
                </div>

                <div class="form-group">
                    <label for="input-needcoin" class="col-sm-2 control-label">审核状态</label>
                    <div class="col-md-6 col-sm-10">
                        <select class="form-control" name="goods_verify">
                            <option value="1">已审核</option>
                            <option value="0">未审核</option>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label for="input-content" class="col-sm-2 control-label">{:lang('商品详情')}</label>
                    <div class="col-md-6 col-sm-10">
                        <script type="text/plain" id="content" name="goods_content" {$data.goods_content|default=''}></script>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('确认')}</button>
                        <a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <script src="__STATIC__/js/admin.js"></script>
    <script type="text/javascript">
        //编辑器路径定义
        var editorURL = GV.WEB_ROOT;
    </script>
    <script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
    <script type="text/javascript">
        $(function () {
            editorcontent = new baidu.editor.ui.Editor();
            editorcontent.render('content');
            try {
                editorcontent.sync();
            } catch (err) {
            }
        })

    </script>

    <script type="text/html" id="photos-item-wrapper">
        <li id="savedimage{id}">
            <input id="photo-{id}" type="hidden" name="goods_images[]" value="{filepath}">
            <a href="javascript:uploadOneImage('图片上传','#photo-{id}');">
                <img src="{preview_url}" id="photo-{id}-preview" style="width:150px;cursor: pointer">
            </a>
            <a href="javascript:(function(){$('#savedimage{id}').remove();})();">移除</a>
        </li>
    </script>

</body>
</html>